home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2 Examples.sit
/
Raven 1.2 Examples
/
Quill
/
Source
/
LocationEditor.cpp
< prev
next >
Wrap
Text File
|
1997-02-20
|
4KB
|
144 lines
/*
* File: LocationEditor.cpp
* Summary: A view that knows how to edit a pane's location.
* Written by: Jesse Jones
*
* Copyright ゥ 1996 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <-> 11/24/96 JDJ Created
*/
#include "LocationEditor.h"
#include <ZTextBox.h>
// ===================================================================================
// class CEditLocationCommand
// ===================================================================================
//---------------------------------------------------------------
//
// CEditLocationCommand::~CEditLocationCommand
//
//---------------------------------------------------------------
CEditLocationCommand::~CEditLocationCommand()
{
}
//---------------------------------------------------------------
//
// CEditLocationCommand::CEditLocationCommand
//
//---------------------------------------------------------------
CEditLocationCommand::CEditLocationCommand(TPane* pane, const SPaneInfo& oldInfo, const SPaneInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
{
}
//---------------------------------------------------------------
//
// CEditLocationCommand::UpdatePane
//
//---------------------------------------------------------------
void CEditLocationCommand::UpdatePane(const SPaneInfo& info)
{
mPane->SetLocation(info.loc);
mPane->SetSize(info.size);
}
#pragma mark -
// ===================================================================================
// CLocationEditor
// ===================================================================================
static TReanimatorRegister<CLocationEditor> sLocationEditorRegistrar;
//---------------------------------------------------------------
//
// CLocationEditor::~CLocationEditor
//
//---------------------------------------------------------------
CLocationEditor::~CLocationEditor()
{
}
//---------------------------------------------------------------
//
// CLocationEditor::CLocationEditor
//
//---------------------------------------------------------------
CLocationEditor::CLocationEditor(TView* superView) : Inherited(superView)
{
}
//---------------------------------------------------------------
//
// CLocationEditor::Create [static]
//
//---------------------------------------------------------------
MReanimatable* CLocationEditor::Create(MReanimatable* parent)
{
return new CLocationEditor(dynamic_cast<TView*>(parent));
}
//---------------------------------------------------------------
//
// CLocationEditor::GetEditorInfo
//
//---------------------------------------------------------------
SPaneInfo CLocationEditor::GetEditorInfo() const
{
SPaneInfo info;
TTextBox* textBox = nil;
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Left"));
info.loc.h = textBox->GetValue();
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Top"));
info.loc.v = textBox->GetValue();
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Width"));
info.size.width = textBox->GetValue();
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Height"));
info.size.height = textBox->GetValue();
return info;
}
//---------------------------------------------------------------
//
// CLocationEditor::SetEditorInfo
//
//---------------------------------------------------------------
void CLocationEditor::SetEditorInfo(const SPaneInfo& info)
{
TTextBox* textBox = nil;
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Left"));
textBox->SetValue(info.loc.h);
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Top"));
textBox->SetValue(info.loc.v);
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Width"));
textBox->SetValue(info.size.width);
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Height"));
textBox->SetValue(info.size.height);
}